package com.itheima.servlet;

import com.itheima.domain.User;
import com.itheima.service.UserService;
import com.itheima.service.impl.UserServiceImpl;
import org.apache.ibatis.jdbc.Null;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/user/*")
public class UserServlet extends BaseServlet{
//    创建sevice对象,方便调用方法
    private UserService userService=new UserServiceImpl();

    private void login(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    // 获取页面参数
        String email = req.getParameter("email");
        String password = req.getParameter("password");
        User user = userService.login(email, password);
    // 判断跳转页面
    if(user != null){
        req.getRequestDispatcher("/user/list").forward(req,resp);
    }else {
        req.getRequestDispatcher("/error.jsp").forward(req,resp);
    }
    }
}
